package com.guonl.controller;


import com.guonl.annotations.SignatureValidation;
import com.guonl.open.api.client.OpenApiWaybillClient;
import com.guonl.open.api.request.waybill.*;
import com.guonl.open.api.response.OpenApiResult;
import com.guonl.open.api.response.waybill.ApiTransportNoteInfoResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @see OpenApiWaybillClient
 */
@Slf4j
@Api(tags = "open-api-运单管理")
@Validated
@RestController
@RequestMapping("/oauth/v1/waybill")
public class OpenApiWaybillController {

    /**
     * {@link OpenApiWaybillClient#createTransportNote(ApiCreateTransportNoteRequest, String)}
     *
     * @param transportNoteRequest
     * @return
     */
    @SignatureValidation
    @ApiOperation(value = "创建运单", notes = "创建运单")
    @PostMapping("/create")
    public OpenApiResult<ApiTransportNoteInfoResponse> createTransportNote(@RequestBody @Validated ApiCreateTransportNoteRequest transportNoteRequest) {
        ApiTransportNoteInfoResponse transportNoteInfo = new ApiTransportNoteInfoResponse();
        return OpenApiResult.ok(transportNoteInfo);
    }

    /**
     * {@link OpenApiWaybillClient#transportNoteUpdateFreight(ApiTransportNoteUpdateFreightRequest, String)}
     *
     * @param updateFreightRequest
     * @return
     */
    @SignatureValidation
    @ApiOperation(value = "修改运费", notes = "修改运费")
    @PostMapping("/updateFreight")
    public OpenApiResult<Boolean> transportNoteUpdateFreight(@RequestBody @Validated ApiTransportNoteUpdateFreightRequest updateFreightRequest) {
        Boolean aBoolean = Boolean.TRUE;
        return OpenApiResult.ok(aBoolean);
    }


    /**
     * {@link OpenApiWaybillClient#closeTransportNote(ApiCloseTransportNoteRequest, String)}
     *
     * @param closeTransportNoteRequest
     * @return
     */
    @SignatureValidation
    @ApiOperation(value = "关闭运单", notes = "关闭运单")
    @PostMapping("/close")
    public OpenApiResult<Boolean> closeTransportNote(@RequestBody @Validated ApiCloseTransportNoteRequest closeTransportNoteRequest) {
        Boolean aBoolean = Boolean.TRUE;
        return OpenApiResult.ok(aBoolean);
    }

    /**
     * {@link OpenApiWaybillClient#transportNoteVehicleTrack(ApiVehicleTrackRequest, String)}
     *
     * @param vehicleTrackRequest
     * @return
     */
    @SignatureValidation
    @ApiOperation(value = "添加运单车辆轨迹", notes = "添加运单车辆轨迹")
    @PostMapping("/addVehicleTrack")
    public OpenApiResult<Boolean> transportNoteVehicleTrack(@RequestBody @Validated ApiVehicleTrackRequest vehicleTrackRequest) {
        Boolean aBoolean = Boolean.TRUE;
        return OpenApiResult.ok(aBoolean);
    }


}
